<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Verify a CMS signature</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.openssl-cms-sign.html">« openssl_cms_sign</a></li>
      <li style="float: right;"><a href="function.openssl-csr-export-to-file.html">openssl_csr_export_to_file »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.openssl.html">OpenSSL 函数</a></li>
    <li>Verify a CMS signature</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.openssl-cms-verify" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_cms_verify</h1>
  <p class="verinfo">(PHP 8)</p><p class="refpurpose"><span class="refname">openssl_cms_verify</span> &mdash; <span class="dc-title">Verify a CMS signature</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-cms-verify-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_cms_verify</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$input_filename</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = 0</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$certificates</code><span class="initializer"> = <strong><code>null</code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">array</span> <code class="parameter">$ca_info</code><span class="initializer"> = []</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$untrusted_certificates_filename</code><span class="initializer"> = <strong><code>null</code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$content</code><span class="initializer"> = <strong><code>null</code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$pk7</code><span class="initializer"> = <strong><code>null</code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$sigfile</code><span class="initializer"> = <strong><code>null</code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$encoding</code><span class="initializer"> = <strong><code>OPENSSL_ENCODING_SMIME</code></strong></span></span><br>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   This function verifies a CMS signature, either attached or detached, with the specified encoding.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-cms-verify-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">input_filename</code></dt>

    <dd>

     <p class="para">
      The input file.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">flags</code></dt>

    <dd>

     <p class="para">
      Flags to pass to <span class="function"><strong>cms_verify()</strong></span>.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">certificates</code></dt>

    <dd>

     <p class="para">
      A file with the signer certificate and optionally intermediate certificates.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">ca_info</code></dt>

    <dd>

     <p class="para">
      An array containing self-signed certificate authority certificates.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">untrusted_certificates_filename</code></dt>

    <dd>

     <p class="para">
      A file containing additional intermediate certificates.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">content</code></dt>

    <dd>

     <p class="para">
      A file pointing to the content when signatures are detached.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">pk7</code></dt>

    <dd>

     <p class="para">

     </p>
    </dd>

   
   
    <dt>
<code class="parameter">sigfile</code></dt>

    <dd>

     <p class="para">
      A file to save the signature to.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">encoding</code></dt>

    <dd>

     <p class="para">
      The encoding of the input file. One of <strong><code>OPENSSL_ENCODING_SMIME</code></strong>,
      <strong><code>OPENSSL_ENCODING_DER</code></strong> or <strong><code>OPENSSL_ENCODING_PEM</code></strong>.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-cms-verify-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
 </div>


</div></div></div></body></html>